/**
 * 工作任务管理
 */
Ext.define('Module.task.Worksy', {
	extend : 'Ext.panel.Panel',
	layout: 'fit',
	border: false,
	requires: ['Module.task.MultiVideoPlay'],
	initComponent : function() {
		var me = this;
		
		var _fields = ['bz_name','bz_code','bzzy_code','bzzy_name','content','city','region','bdz_name','bdz_code',
           'dept','planuser','plan_time','starttime','endtime','powercut','f_stage','syntime',
           'upusername','uptime','enable','bz_id','major_id','transformer_id',
           'plan_dept_id','plan_user_id','plandept','transformer','status','zylx'];
		
		var store = Ext.create('Ext.data.Store',{
			autoLoad: true,
			fields: _fields,
			proxy:{
				type:'ajax',
				url:'worksy/list.do',
				root:'rows',
				reader:{
					root: 'datas',
					totalProperty: 'total'
				} 
			}
		});
		var grid  = me.grid= Ext.create("Ext.grid.Panel",{
			listeners:{
				afterrender:function(){
					grid.down('field[name=startTime]').setValue();
					grid.down('field[name=endTime]').setValue();
					grid.down('field[name=planStime]').setValue();
					grid.down('field[name=planEtime]').setValue();
				},
				itemdblclick:function(s,rec,item){
		    		Ext.create('Module.task.TaskDetails',{
		    			type: 1,
		    			rwdata: rec.raw
		    		}).show();
		    	}
			},
			title:'工作任务管理',
			tbar: {
				xtype:'form',
				bodyStyle:{'background-color':'rgb(219, 242, 239)'},
				layout:'absolute',
				height:110,
				items:[{
					xtype: 'button',
					text:'添加任务',
					x: 5,
					y: 80,
					iconCls:'icon-add',
					handler:function(){
						me.edit();
					}
				},{
					xtype: 'button',
					text:'修改任务',
					x: 90,
					y: 80,
					iconCls:'icon-edit',
					handler:function(){
						var rec = grid.getSelectionModel().getSelection();
						if(rec.length > 0){
							me.edit(rec[0]);
						}else{
							Ext.Msg.alert('提示', '请选择要修改的数据！');
						}
					}
				},{
					xtype: 'button',
					text:'删除任务',
					x: 175,
					y: 80,
					iconCls:'icon-delete',
					handler:function(){
						var rec = grid.getSelectionModel().getSelection()[0];
						if(rec){
							me.del(rec);
						}else{
							Ext.Msg.alert('提示', '请选择要删除的数据！');
						}
					}
				},{
					xtype: 'button',	
					text:'Excel导入',
					x:260,
					y: 80,
					iconCls:'icon-File_XLS_Excel',
					handler:function(){
						var fp = Ext.create('Ext.window.Window',{
							width:400,
							height:103,
							modal:true,
							layout: 'fit',
							title: '任务导入',
							buttonAlign: 'center',
							items:[{
								xtype:'form',
								bodyPadding: 10,
								border: false,
								items:[{  
									xtype: 'fileuploadfield',  
									emptyText: '请选择导入文件',  
									fieldLabel: '',  
									name: 'file',  
									buttonText: '选择文件',  
									anchor:'100%',
									bodyPadding: 10,
									allowBlank: false,
									buttonCfg: {  
										iconCls: 'upload-icon'  
									}  
								}]
							}],
							buttons:[{
								text:'导入',
								handler:function(){
									var _form = fp.down('form').getForm();
									if(_form.isValid()){
										_form.submit({
											url:'worksy/impExcel.do',
											waitMsg: '请稍等，正在上传数据...',
											success: function(form, action) {
												var rs = Ext.decode(action.response.responseText);
												if(rs.rst){
													fp.close();
													Ext.Msg.alert('提示', rs.msg);
													me.grid.store.load();
												}
												else{
													Ext.Msg.alert('提示', rs.msg);
												}
											}
										});
									}
								}
							},{
								text:'取消',
								handler:function(){
									fp.close();
								}
							}]
						}).show();
					}
				},{
					xtype: 'button',
					text:'多角度视频回放',
					x: 350,
					y: 80,
					iconCls:'icon-play',
					handler:function(){
						var rec = grid.getSelectionModel().getSelection()[0];
						if(rec){
							Ext.create('Module.task.MultiVideoPlay',{
								rwdata: rec.data,
								rwtype: 1
							}).show();
						}else{
							Ext.Msg.alert('提示', '请选择任务!');
						}
					}
				},{
					xtype: 'button',
					text:'查看详情',
					x: 470,
					y: 80,
					iconCls:'icon-grid',
					handler:function(){
						var rec = grid.getSelectionModel().getSelection()[0];
						if(rec){
							Ext.create('Module.task.TaskDetails',{
				    			type: 1,
				    			rwdata: rec.raw
				    		}).show();
						}else{
							Ext.Msg.alert('提示', '请选择任务!');
						}
					}
				},{
					xtype: 'button',
					text:'实时视频',
					x: 555,
					y: 80,
					iconCls:'icon-play',
					handler:function(){
						var rec = grid.getSelectionModel().getSelection()[0];
						if(rec){
							Ext.Ajax.request({
							    url: 'test/exec.do',
							    success: function(response,action){
							    	var rs = Ext.decode(response.responseText);
							    	if(!rs.rst){
							    		Ext.Msg.alert('提示', rs.msg);
							    	}
							    }
							});
						}else{
							Ext.Msg.alert('提示', '请选择任务!');
						}
					}
				},{
					x:17,
					y:5,
					labelWidth:50,
					xtype:'combobox',
					fieldLabel: '变电站',
					readOlay:true,
					displayField: 'name',
					valueField: 'id',
					queryMode: 'local',
					store: Ext.create('Ext.data.Store',{
						autoLoad: true,
						fields: ['id','name'],
						proxy: {
							type: 'ajax',
							url: 'worksy/getBdz.do'
						}
					})
				},{
					x:298,
					y:5,
					labelWidth:35,
					xtype:'combobox',
					name:'major_id',
					fieldLabel: '专业',
					readOlay:true,
					displayField: 'name',
					valueField: 'id',
					queryMode: 'local',
					store: Ext.create('Ext.data.Store',{
						autoLoad: true,
						fields: ['id','name'],
						proxy: {
							type: 'ajax',
							url: 'worksy/getzy.do'
						}
					}),
					listeners:{
						select:function(c){
							var bzclear = c.up('form').down('field[fieldLabel=工作班组]');
							bzclear.setValue();
						}
					}
				},{
					x:544,
					y:5,
					labelWidth:55,
					xtype:'combobox',
					fieldLabel: '工作班组',
					readOlay:true,
					displayField: 'name',
					valueField: 'id',
					queryMode: 'local',
					store: Ext.create('Ext.data.Store',{
						fields: ['id','name'],
						proxy: {
							type: 'ajax',
							url: 'worksy/getBz.do'
						}
					}),
					listeners: {
						afterrender: function(c){
							var zycombo = c.up('form').down('field[fieldLabel=专业]');//.getSubmitValue().trim(),
							c.addManagedListener(zycombo,'select',function(){
								c.store.load({params:{
									zyId: zycombo.getSubmitValue()
								}});
							});
						}
					}	
				},{
					x:800,
					y:5,
					labelWidth:60,
					width:Ext.isIE8 ? 200: (Ext.isIE ? 200: 200),
					fieldLabel: '完成阶段',
					xtype:'textfield',
					maxLength:16
				},{
					x:5,
					y: 30,
					labelWidth:62,
					width:Ext.isIE8 ? 212: (Ext.isIE ? 220: 230),
					fieldLabel: '停电范围',
					xtype:'textfield',
					maxLength:16
				},{
					x:250,
					y: 30,
					name: 'startTime',
					fieldLabel: '计划开始时间',
					labelWidth:82,
					xtype:'datefield',
					format:'Y-m-d H:i:s',
					//editable:false,
					value:Ext.util.Format.date(Ext.Date.add(new Date(),Ext.Date.MONTH,0),"Y-m-d H:i:s")
				},{
					x:520,
					y: 30,
					name: 'endTime',
					fieldLabel: '计划结束时间',
					labelWidth:80,
					xtype:'datefield',
					format:'Y-m-d H:i:s',
					//editable:false,
					value:Ext.util.Format.date(Ext.Date.add(new Date(),Ext.Date.MONTH,0),"Y-m-d H:i:s")
				},{
					x:800,
					y: 30,
					labelWidth:60,
					width:Ext.isIE8 ? 200: (Ext.isIE ? 200: 200),
					fieldLabel: '任务内容',
					xtype:'textfield',
					maxLength:120
				},{
					x:5,
					y: 55,
					name: 'status',
					fieldLabel: '是否完成',
					width:Ext.isIE8 ? 212: (Ext.isIE ? 220: 230),
					labelWidth:62,
					xtype: 'combobox',
					store: {
						xtype: 'store',
						fields: ['status', 'p'],
						data : [
					        {status: 0,p: '否'},
					        {status: 1,p: '是'}
						]
					},
					queryMode: 'local',
					displayField: 'p',
					valueField: 'status'
				},{
					x:250,
					y: 55,
					name: 'planStime',
					fieldLabel: '编制开始时间',
					labelWidth:82,
					xtype:'datefield',
					format:'Y-m-d',
					editable:false,
					submitFormat: 'Y-m-d',
					value:Ext.util.Format.date(Ext.Date.add(new Date(),Ext.Date.MONTH,0),"Y-m-d")
				},{
					x:520,
					y: 55,
					name: 'planEtime',
					fieldLabel: '编制结束时间',
					labelWidth:80,
					xtype:'datefield',
					format:'Y-m-d',
					editable:false,
					submitFormat: 'Y-m-d',
					value:Ext.util.Format.date(Ext.Date.add(new Date(),Ext.Date.MONTH,0),"Y-m-d")
				},{
					xtype:'button',
					x:780,
					y: 55,
					text:'查询',
					width: 55,
					iconCls: 'icon-search',
					handler:function(){
						var startTime = grid.down('field[name=startTime]').getSubmitValue();
						var endTime = grid.down('field[name=endTime]').getSubmitValue();
						if(new Date(startTime) > new Date(endTime)){
							Ext.Msg.alert('提示', "计划开始时间大于计划结束时间，请重新选择！");
							return;
						}
						var planStime = grid.down('field[name=planStime]').getSubmitValue();
						var planEtime = grid.down('field[name=planEtime]').getSubmitValue();
						if(new Date(planStime) > new Date(planEtime)){
							Ext.Msg.alert('提示', "编制开始时间大于结束时间，请重新选择！");
							return;
						}
						var fStage = grid.down('field[fieldLabel=完成阶段]').getSubmitValue();
						var powercut = grid.down('field[fieldLabel=停电范围]').getSubmitValue();
						var content = grid.down('field[fieldLabel=任务内容]').getSubmitValue();
						
						if(fStage.length > 16 || powercut.length > 16 || content.length > 120) return;
						grid.store.proxy.extraParams = {
								bdz: grid.down('field[fieldLabel=变电站]').getSubmitValue(),
								bz: grid.down('field[fieldLabel=工作班组]').getSubmitValue(),
								zy: grid.down('field[fieldLabel=专业]').getSubmitValue(),
								fStage:grid.down('field[fieldLabel=完成阶段]').getSubmitValue(),
								powercut:grid.down('field[fieldLabel=停电范围]').getSubmitValue(),
								startTime:grid.down('field[name=startTime]').getSubmitValue(),
								endTime:grid.down('field[name=endTime]').getSubmitValue(),
								status:grid.down('field[name=status]').getSubmitValue(),
								content:grid.down('field[fieldLabel=任务内容]').getSubmitValue(),
								planStime:grid.down('field[name=planStime]').getSubmitValue(),
								planEtime:grid.down('field[name=planEtime]').getSubmitValue()
						};
						grid.store.loadPage(1);
					}
				},{
					xtype:'button',
					x:840,
					y: 55,
					text:'重置',
					width: 35,
					handler:function(){
						grid.down('field[fieldLabel=变电站]').setValue();
						grid.down('field[fieldLabel=工作班组]').setValue();
						grid.down('field[fieldLabel=工作班组]').store.removeAll();
						grid.down('field[fieldLabel=专业]').setValue();
						grid.down('field[fieldLabel=完成阶段]').setValue();
						grid.down('field[fieldLabel=停电范围]').setValue();
						grid.down('field[name=startTime]').setValue();
						grid.down('field[name=endTime]').setValue();
						grid.down('field[name=status]').setValue();
						grid.down('field[name=planStime]').setValue();
						grid.down('field[name=planEtime]').setValue();
						grid.down('field[fieldLabel=任务内容]').setValue();
					}
				}]
			},
			bbar: Ext.create('Ext.PagingToolbar', {
	            store: store,
	            displayInfo: true,
	            displayMsg: '显示第 {0} 至 {1} 条记录，共 {2} 条',
	            emptyMsg: "无记录"
	        }),
			store:store,
			columns:[{
				text: 'ID',
				dataIndex: 'id',
				width: 80,
				hidden: true
			},{
				text: '变电站',
				dataIndex: 'bdz_name',
				width: 120,
				hidden:false
			},{
				text: '工作班组',
				dataIndex: 'bz_name',
				width: 120
			},{
				text: '专业',
				dataIndex: 'bzzy_name',
				width: 120
			},{
				text: '所属地市',
				dataIndex: 'city',
				width: 140
			},{
				text: '编制部门',
				dataIndex: 'plandept',
				width: 140
			},{
				text: '编制人',
				dataIndex: 'planuser',
				width: 120
			},{
				text: '编制日期',
				dataIndex: 'plan_time',
				width: 130
			},{
				text: '任务内容',
				dataIndex: 'content',
				width: 250
			},{
				text: '任务计划开始时间',
				dataIndex: 'starttime',
				width: 130,
				renderer: formatDate
			},{
				text: '任务计划结束时间',
				dataIndex: 'endtime',
				width: 130,
				renderer: formatDate
			},{
				text: '停电范围',
				dataIndex: 'powercut',
				width: 120
			},{
				text: '完成阶段',
				dataIndex: 'f_stage',
				width: 120
			},{
				text: '同步时间',
				dataIndex: 'syntime',
				width: 130,
				renderer: formatDate
			},{
				text: '是否完成',
				dataIndex: 'status',
				width: 80,
				renderer:function(v){
					return v == 1?'是':'否';
				}
			},{
				text: '更新用户',
				dataIndex: 'upusername',
				width: 120
			},{
				text: '更新时间',
				dataIndex: 'uptime',
				width: 130,
				renderer: formatDate
			}]
		});

		me.items = grid;
		me.callParent();
	},
	edit:function(rec){
		var me = this;
		Ext.create("Ext.window.Window",{
			width:500,
			height:465,
			modal:true,
			iconCls: rec ? 'icon-edit' : 'icon-add',
			title: rec ? '修改任务' : '添加任务',
			buttons:[{
				text:'保存',
				handler:function(){
					var _win = this.up('window');
					var formp = this.up('panel').items.items[0];
					var ot = formp.getValues();
					var startTime = ot.starttime;
					var endTime = ot.endtime;
					if(new Date(startTime) > new Date(endTime)){
						Ext.Msg.alert('提示', "计划开始时间大于计划结束时间，请重新选择！");
						return;
					}
        	    	var form = formp.form;
        	    	if(form.isValid()){
        	    		form.submit({
            	    	    url: 'worksy/edit.do',
            	    	    success: function(form, action) {
            	    	       var rs = Ext.decode(action.response.responseText);
            	    	       if( rs.msg == '系统中存在此任务。'){
            	    	    	   Ext.MessageBox.confirm("提示", '系统中存在此任务。是否查看任务？', function(btn) {  
            	                        if(btn == 'yes'){
            	                        	_win.close();
            	                        	var fp = form.getValues();
            	                        	me.grid.store.proxy.url = 'worksy/inspectSameTask.do';
            	                        	me.grid.store.proxy.extraParams = fp;
            	                        	me.grid.store.load();
            	                        	
            	                        }
            	                   });  
            	    	    	   
            	    	    	   return;
            	    	       }
    	       	    	    	if(rs.rst){
    	       	    	    		Ext.Msg.alert('提示', rs.msg);
    	       	    	    		formp.up('window').close();
    	       	    	    		me.grid.store.load();
    	       	    	    	}
    	       	    	    	else{
    	       	    	    		Ext.Msg.alert('提示', '保存失败！');
    	       	    	    	}
            	    	    }
            	    	});
        	    	}
        	    	else{
        	    		Ext.Msg.alert('提示', '请填写正确的数据信息。');
        	    	}
				}
			},{
				text:'取消',
				handler:function(){
					this.up('window').close();
				}
			}],
			items:me.getForm({
				bodyPadding: 20,
				border: false,
				defaults: {anchor: '100%'},
				listeners: {
					afterrender: function(formp){
						if(rec){
							formp.loadRecord(rec||{});
							formp.form.setValues({
								syntime: new Date(rec.data.syntime),
								endtime: new Date(rec.data.endtime),
								starttime: new Date(rec.data.starttime),
								plan_time: Ext.Date.parse(rec.data.plan_time, "Y-m-d")
							});
						}
					}
				}
			},rec)
		}).show();
	},
	del:function(rec){
		var me = this;
			Ext.Msg.confirm('提示', '删除该数据后将不再关联视频，你确定要删除当前数据吗？',function(b){
				if('yes' == b){
					Ext.Ajax.request({
					    url: 'worksy/del.do',
					    params: {
					        id: rec.data.id,
					        content:rec.data.content
					    },
					    success: function(response,action){
					    	var rs = Ext.decode(response.responseText);
					    	Ext.Msg.alert('提示', rs.msg);
					    	me.grid.store.load();
					    }
					});
				}
			});
	},
	getForm:function(config,rec){
		return Ext.apply({
			xtype: 'form',
			bodyPadding: 10,
			defaults: {allowBlank: false},
			items: [{
				xtype: 'hidden',
				name: 'id'
			}/*,{
				xtype: 'textfield',
				name: 'transformer',
				fieldLabel: '电站|线路',
				maxLength:70,
				allowBlank: false
			}*/,{
				allowBlank: false,
				xtype:'combobox',
				name:'region',
				fieldLabel: '地市单位',
				displayField: 'name',
				valueField: 'id',
				queryMode: 'local',
				store: Ext.create('Ext.data.Store',{
					autoLoad: true,
					fields: [{name:'id',type:'string'},'name'],
					proxy: {
						type: 'ajax',
						url: 'worksy/getCity.do'
					}
				}),
				listeners:{
					select:function(c){
						c.up('form').down('combobox[name=transformer_id]').setValue();
					}
					/*change:function(f){
						f.up('form').form.setValues({
							city:f.getRawValue()
						});
					}*/
				}
			
			},{
				allowBlank: false,
				xtype:'combobox',
				name:'transformer_id',
				fieldLabel: '变电站',
				displayField: 'name',
				valueField: 'id',
				queryMode: 'local',
				store: Ext.create('Ext.data.Store',{
//					autoLoad: rec?true:false,
					autoLoad: false,
					fields: ['id','name'],
					proxy: {
						type: 'ajax',
						//extraParams:{companyId:me.down('pecombobox').getSubmitValue()},
						url: 'worksy/getBdz.do'
					}
				}),
				listeners:{
					
					boxready: function(c){
						c.store.load({params:{
							regionId: c.up('form').down('combobox[name=region]').getValue()
						}});
						var region = c.up('form').down('combobox[name=region]');
						c.addManagedListener(region,'select',function(){
							c.store.load({params:{
								regionId: region.getSubmitValue()
							}});
						});
					}
				}
			},{
				xtype: 'textfield',
				name: 'content',
				fieldLabel: '任务内容',
				maxLength:300,
				regex:/^\w+$/,
				regexText:'输入不合法',
				allowBlank: false
			}/*,{
				name:'city',
				xtype:'hidden'
			}*//*,{
				xtype: 'hidden',
				name: 'transformer'
			}*/,{
				allowBlank: false,
				xtype:'combobox',
				name:'major_id',
				fieldLabel: '专业',
				displayField: 'name',
				valueField: 'id',
				queryMode: 'local',
				store: Ext.create('Ext.data.Store',{
					autoLoad: true,
					fields: [{name:'id',type:'string'},'name'],
					proxy: {
						type: 'ajax',
						url: 'worksy/getzy.do'
					}
				}),
				listeners:{
					select:function(c){
						c.up('form').down('combobox[name=bz_id]').setValue();
					}
				}
			},{
				allowBlank: false,
				xtype:'combobox',
				name:'bz_id',
				fieldLabel: '工作班组',
				displayField: 'name',
				valueField: 'id',
				queryMode: 'local',
				store: Ext.create('Ext.data.Store',{
					autoLoad: false,
					fields: [{name:'id',type:'int'},'name'],
					proxy: {
						type: 'ajax',
						url: 'worksy/getBz.do'
					}
				}),
				listeners: {
					boxready: function(c){
						var _zy = c.up('form').down('combobox[name=major_id]');
						c.store.load({params:{
							zyId: _zy.getSubmitValue()
						}});
						c.addManagedListener(_zy,'select',function(){
							c.store.load({params:{
								zyId: _zy.getSubmitValue()
							}});
						});
					}
				}
			}/*,
			{
				xtype:'hidden',
				name:'plandept'
			}*/,{
				xtype:'textfield',
				name:'plandept',
				fieldLabel:'编制部门',
				maxLength:35,
				regex:/^[\u4E00-\u9FA5A-Za-z0-9]+$/,
				regexText:'输入不合法',
				allowBlank: false
				/*
				xtype:'combobox',
				name:'plan_dept_id',
				fieldLabel: '编制部门',
				displayField: 'name',
				valueField: 'id',
				queryMode: 'local',
				store: Ext.create('Ext.data.Store',{
					autoLoad: true,
					fields: ['id','name'],
					proxy: {
						type: 'ajax',
						url: 'worksy/getDept.do'
					}
				}),
				listeners:{
					change:function(f){
						f.up('form').form.setValues({
							plandept:f.getRawValue()
						});
					}
				}
			*/}/*,{
				xtype:'hidden',
				name:'planuser'
			}*/,{
				xtype:'textfield',
				name:'planuser',
				fieldLabel:'编制人',
//				regex:/^[\u4E00-\u9FA5A-Za-z0-9]+$/,
//				regexText:'不能输入特殊字符',
				maxLength:70,
				allowBlank: false
				
				/*
				xtype:'combobox',
				name:'plan_user_id',
				fieldLabel: '编制人',
				displayField: 'name',
				valueField: 'id',
				queryMode: 'local',
				store: Ext.create('Ext.data.Store',{
					//autoLoad: true,
					fields: ['id','name'],
					proxy: {
						type: 'ajax',
						url: 'worksy/getDeptPeople.do'
					}
				}),
				listeners: {
					listeners:{
						change:function(f){
							f.up('form').form.setValues({
								planuser:f.getRawValue()
							});
						}
					},
					afterrender: function(c){
						var deptcombo = c.up('form').down('combobox[name=plan_dept_id]');
						c.addManagedListener(deptcombo,'select',function(){
							c.store.load({params:{
								deptId: deptcombo.getSubmitValue()
							}});
						});
					}
				}
			*/},{
				name: 'plan_time',
				fieldLabel: '编制日期',
				xtype:'datefield',
				format:'Y-m-d',
				editable:false,
				value:Ext.util.Format.date(Ext.Date.add(new Date(),Ext.Date.MONTH,0),"Y-m-d"),
				allowBlank: false,
				submitFormat: 'Y-m-d',
			},{
				name: 'starttime',
				fieldLabel: '任务计划开始时间',
				xtype:'datefield',
				format:'Y-m-d H:i:s',
				editable:true,
				//value:Ext.util.Format.date(Ext.Date.add(new Date(),Ext.Date.MONTH,0),"Y-m-d H:i:s"),
				allowBlank: false,
				listeners:{
					change:function(c){
						var status = c.up('form').down('field[name=status]');
						if(new Date(c.getValue()) > new Date()){
							status.setValue(0);
						}
					
					}
				}
			},{
				name: 'endtime',
				fieldLabel: '任务计划结束时间',
				xtype:'datefield',
				format:'Y-m-d H:i:s',
				editable:true,
				//value:Ext.util.Format.date(Ext.Date.add(new Date(),Ext.Date.MONTH,0),"Y-m-d H:i:s"),
				allowBlank: false
			},{
				xtype: 'textfield',
				name: 'powercut',
				maxLength:30,
				fieldLabel: '停电范围',
				regex:/^[\u4E00-\u9FA5A-Za-z0-9]+$/,
				regexText:'不能输入特殊字符'
			},{
				xtype: 'textfield',
				name: 'f_stage',
				fieldLabel: '完成阶段',
				maxLength:30,
				regex:/^[\u4E00-\u9FA5A-Za-z0-9]+$/,
				regexText:'不能输入特殊字符',
				allowBlank: false
			},{
				name: 'status',
				fieldLabel: '是否完成',
				xtype: 'combobox',
				store: {
					xtype: 'store',
					fields: ['status', 'p'],
					data : [
				        {status: 0,p: '否'},
				        {status: 1,p: '是'}
					]
				},
				queryMode: 'local',
				displayField: 'p',
				valueField: 'status',
				allowBlank: false,
				listeners:{
					select:function(c){
						var starttime = c.up('form').down('field[name=starttime]').getValue();
						if(c.getValue() == 1){
							if(!starttime){
								c.setValue(0);
							}
							if(new Date(starttime) > new Date()){
								c.setValue(0);
								Ext.Msg.alert('提示', "任务开始时间大于现在时间，任务应为非完成状态");
							}
						}
					}
				}
			},{
				allowBlank: false,
				xtype:'combobox',
				name:'zylx',
				fieldLabel: '作业类型',
				displayField: 'name',
				valueField: 'id',
				queryMode: 'local',
				store: Ext.create('Ext.data.Store',{
					autoLoad: true,
					fields: ['id','name'],
					proxy: {
						type: 'ajax',
						url: 'bzzy/BzzyZygcAction/getJcZyType.do'
					}
				})
			}]
		},config);
	}
});